var openid = getQueryString("openid");
var status_wenjuan = '0';

function mainInfo(){
	$.ajax({
		url: API_URL+'agent/getbyopenid?openid='+openid,
		type: 'GET',
		dataType: "JSON",
		data:'',
		async: false,
		success: function (obj){
			var myData = obj.data[0];
			if(myData.icon == null || myData.icon == ''){
				myData.icon = '../img/default.png';
			}
			$('#per_head').attr({
				'src': myData.icon
				});
			$('#name').text(myData.name);
		},
		error: function (data){
			console.log("服务器异常!");
		}
	});

	
	$.ajax({
		url: 'http://123.57.41.120/NewChinaLifeques/Interface/ques?cmd=findcount&openid='+openid,
		type: 'GET',
		dataType: "JSON",
		data:'',
		async: false,
		success: function (obj){
			if(obj.status.code==0){
				var myData = obj.data[0];
				status_wenjuan = myData.status_wenjuan;
				$('#wenjuan_count').html(myData.count);
			}
		},
		error: function (data){
			console.log("服务器异常!");
		}
	});
}
$(function(){
	$('#checkinfo').on('click',function(){
		window.location = 'personal_information.html?openid='+openid;
	});

	$('#wenjuan').on('click',function(){
		if(status_wenjuan=='0'){
			window.location = 'http://123.57.41.120/NewChinaLifeques/wenjun/wenjun1.html?openid='+openid;
		}else{
			window.location = 'http://123.57.41.120/NewChinaLifeques/wenjun/wenjun6.html';
		}
	});
})
